{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# はじめてのJavaプログラミング\n",
    "\n",
    "## HelloWorld\n",
    "\n",
    "* クラス名\n",
    "    * 先頭を大文字にする\n",
    "    * 複数の単語で構成する場合は各単語の先頭だけ大文字にする\n",
    "        * 例) HelloWorld\n",
    "* ソースコードのファイル名\n",
    "    * (クラス名).java\n",
    "* プログラムの記述\n",
    "    * class内に書く\n",
    "    * Javaアプリケーションはmain()メソッドを定義する必要がある\n",
    "* コンパイル\n",
    "    * コンパイルすると(クラス名).classというクラスファイル(バイトコード)が生成される"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "public class HelloWorld {\n",
      "    public static void main (String[] args) {\n",
      "        System.out.println(\"Hello World !!\");\n",
      "    }\n",
      "}\n",
      "================================================\n",
      "Hello World !!\n"
     ]
    }
   ],
   "source": [
    "%%bash\n",
    "name=HelloWorld\n",
    "\n",
    "### ソースの編集\n",
    "cat <<- EOS > ${name}.java\n",
    "public class ${name} {\n",
    "    public static void main (String[] args) {\n",
    "        System.out.println(\"Hello World !!\");\n",
    "    }\n",
    "}\n",
    "EOS\n",
    "\n",
    "### ソースの確認\n",
    "cat ${name}.java\n",
    "\n",
    "### コンパイル\n",
    "javac ${name}.java\n",
    "\n",
    "### 実行\n",
    "echo \"================================================\"\n",
    "java ${name}"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
